#pragma once
#include <functional>
#include <string>

class Task
{
    using func_t = std::function<int(int, int)>;
public:

    Task()
    {}
    
    Task(int x,int y, char operat, func_t func) 
        : _x(x)
        , _y(y)
        , _operation(operat)
        , __call_back__(func)
    {}

    std::string operator()()
    {
        int ret = __call_back__(_x, _y);
        char buffer[512];
        snprintf(buffer, sizeof(buffer), "%d %c %d = %d", _x, _operation, _y, ret);
        return buffer;
    }

    std::string toStringTask()
    {
        char buffer[512];
        snprintf(buffer, sizeof(buffer), "%d %c %d = ?", _x, _operation, _y);
        return buffer;
    }

private:
    int _x;
    int _y;
    char _operation;
    func_t __call_back__;
};